<?php
/**
 * Users
 *
 * @author liumingl
 * @version
 */
class Users extends Zend_Db_Table_Abstract
{
	/**
	 * The default table name
	 */
	protected $_name = 'users';
	
	private $_select;
	
	public function init()
	{
		parent::init();
		
		$this->_select = $this->select();
	}
	
	public function getSelect()
	{
		return $this->_select;
	}
	
	/**
	 * getUsers —— 按页面得到客户信息
	 *
	 * @param int $page 得到第N页的用户信息
	 * @param int $count 每页的用户数量
	 * @param text 显示的顺序
	 *
	 * @return array
	 */
	public function getUsers($page=1, $count=10, $order='user_id DESC')
	{
		$this->_select->reset();
		$this->_select->from($this->_name, '*');
		$this->_select->order($order);
		//$this->_select->limitPage($page, $count);

		//$result = $this->_db->fetchAll($this->_select);
		
		//return $result ? $result:NULL;
	}
	
	public function getUsersTotalCount()
	{
		$select = $this->_db->select();
		$select->reset();
		$select->from($this->_name, 'COUNT(*) AS nums');
		
		$result = $this->_db->fetchOne($select);
		
		return $result ? $result : 0;
		
	}
}
